from multiprocessing import Process
from core.proxy_spider.run_spiders import RunSpider
from core.proxy_test import ProxyTester
from core.proxy_api import ProxyAPI


def run():

    process_list = []
    process_list.append(Process(target=RunSpider.start))
    process_list.append(Process(target=ProxyTester.start))
    process_list.append(Process(target=ProxyAPI.start))

    # 启动进程
    for process in process_list:
        # 设置进程守护
        process.daemon = True
        # 进程启动
        process.start()

    # 让主进程等待子进程完成
    for p in process_list:
        p.join()

if __name__ == '__main__':
    run()